package com.blog.service.Impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.blog.dao.ChattingRecordsDao;
import com.blog.dao.UserDao;
import com.blog.dao.impl.ChattingRecordsDaoImpl;
import com.blog.dao.impl.UserDaoImpl;
import com.blog.entity.ChattingRecord;
import com.blog.entity.User;
import com.blog.service.cRecordService;

public class cRecordServiceImpl implements cRecordService {
	private UserDao ud = new UserDaoImpl();
	private ChattingRecordsDao crd = new ChattingRecordsDaoImpl();
	@Override
	public Map<String, Object> selectRecordById(int sendId, int receiveId) {
		// TODO Auto-generated method stub
		User sendUser = ud.selectUserByUserId(sendId);
		User receiveUser = ud.selectUserByUserId(receiveId);
		List<ChattingRecord> list = crd.selectRecordBySendIdAndReceiveId(sendId, receiveId, 50);
		Map<String, Object> map = new HashMap();
		if(sendUser!= null ) {
			map.put("sendUser", sendUser);
		}
		if(receiveUser!= null ) {
			map.put("receiveUser", receiveUser);
		}
		map.put("recordList", list);
		return map;
	}

}
